<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/Static/Css/reset.css" />
<link rel="stylesheet" type="text/css" href="/Static/Css/zh-cn-system.css" />
<link rel="stylesheet" type="text/css" href="/Static/Css/table_form.css" />
<script src="/Public/js/jquery.min.js"></script>
<script src="/Public/js/jquery.form.js"></script>
<script src="/Public/js/main.js"></script>
<script type="text/javascript" src="/Public/artDialog/jquery.artDialog.js?skin=default"></script>
<script type="text/javascript" src="/Public/artDialog/plugins/iframeTools.js"></script>
</head>
<body>

<div class="subnav">
  <div class="explain-col" style="position: relative; height:24px;">
  	<span class="red">温馨提示：</span>为了避免不小心操作误删导致用户不能正常访问，暂时不开放删除功能。
      <div class="content-menu" style="position: absolute; right: 30px;top: 5px;">
        <a href="javascript:openWinBox('/index.php/role/add','添加')" class="add fb"><em>添加角色</em></a>
      </div>
  </div>
</div>
<!--subnav-->
<div class="pad-lr-10">
  <form name="myform" action="" method="post" id="myform">
    <div class="table-list">
    <table width="100%" cellspacing="0">
      <thead>
        <tr>
          <th align="center" width="50">序号</th>
          <th align="left" width="180">角色名称</th>
          <th align="left">备注</th>
          <th align="center" width="50">状态</th>
          <th align="center" width="100">创建时间</th>
          <th align="center" width="160">操作</th>
        </tr>
      </thead>
      <tbody id="list">
        <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr id="list_<?php echo ($vo["id"]); ?>">
            <td align="center"><?php echo ($i); ?></td>
            <td align="left"><?php echo ($vo["name"]); ?></td>
            <td align="left"><?php echo ($vo["remark"]); ?></td>
            <td align="center"><?php echo (statusArr($vo["status"])); ?></td>
            <td align="center"><?php echo (date('Y-m-d',$vo["create_time"])); ?></td>
            <td align="center">
              <a href="javascript:openWinBox('/index.php/role/add/id/<?php echo ($vo["id"]); ?>','编辑');" >【编辑】</a>
              <a href="javascript:del(<?php echo ($vo["id"]); ?>);" >【删除】</a>
            </td>
          </tr><?php endforeach; endif; else: echo "" ;endif; ?>
      </tbody>
    </table>
    <div class="btn"> </div>
  </form>
  <div id="pages"><?php echo ($page); ?></div>
</div>
</body>
</html>
<script type="text/javascript">
$(function(){
	$('#myform').ajaxForm({
		beforeSubmit:  checkForm,
		success:       complete,
		dataType: 'json'
	});

	function checkForm(){
		var len = $("input[name='spaceid[]']:checked").length;
		if(len < 1){
			msg('先选择删除项！','warning',4);
			return false;
		}
	}

	var origin = $.artDialog.open.origin;
	function complete(data){
		msg(data.info,data.data);
		if(data.data) setTimeout(function(){origin.location.reload();},1000);
	}
})

function del(id){
  $.get('/index.php/role/del/id/'+id,{},function(data){
    if(data.status==1){
      $("#list_"+id).remove();
    }
  })
}
</script>